/**
 *获取图片文件的宽高
 *file 图片文件流
 */
export default function getImgResolutionRatios(file: any) {
  return new Promise((resolve) => {
    const imgResolutionRatio = {
      width: 120,
      height: 120,
    };
    const reader = new FileReader();
    reader.readAsDataURL(file);
    reader.onload = (e) => {
      const imgSrc: any = e.target?.result || "";
      const img = new Image();
      img["src"] = imgSrc;
      img.onload = () => {
        imgResolutionRatio.width = img.width;
        imgResolutionRatio.height = img.height;
        resolve(imgResolutionRatio);
      };
    };
  });
}
